
function trim(val)
 { 
	return val.replace(/(\s*$)/g, "");  
}
function subForm(){
      //alert(document.getElementById('pos_name').value);
		if(document.getElementById('pos_name').value==""){

				alert('请输入广告位名称！');

				document.getElementById('pos_name').focus();

				return false;

			}

		if(document.getElementById('adv_type').value==""){

				alert('请选择广告类型！');

				document.getElementById('adv_type').focus();

				return false;

			}
			if(document.getElementById('price').value==""){

				alert('请输入价格！');

				document.getElementById('price').focus();

				return false;

			}
			IsURL();
    document.addForm.submit();

   
}
function Num(){
	
		if(isNaN(document.getElementById('price').value)){

				alert('价格必须是数字！');

				document.getElementById('price').value="";
				document.getElementById('price').focus();
				return false;

			}
				if(isNaN(document.getElementById('pos_num').value)){

				alert('数量必须是数字！');

				document.getElementById('pos_num').value="";
				document.getElementById('pos_num').focus();
				return false;

			}
				if(isNaN(document.getElementById('word_num').value)){

				alert('文字限制必须是数字！');

				document.getElementById('word_num').value="";
				document.getElementById('word_num').focus();
				return false;

			}
			
			
	
	}
	function IsURL(){    
		var email=document.getElementById('page_url').value;
		myReg = "^((https|http|ftp|rtsp|mms)?://)"+ "?(([0-9a-z_!~*'().&=+$%-]+: )?[0-9a-z_!~*'().&=+$%-]+@)?" //ftp的user@
		        + "(([0-9]{1,3}\.){3}[0-9]{1,3}" // IP形式的URL- 199.194.52.184
		        + "|" // 允许IP和DOMAIN（域名）
		        + "([0-9a-z_!~*'()-]+\.)*" // 域名- www.
		        + "([0-9a-z][0-9a-z-]{0,61})?[0-9a-z]\." // 二级域名
		        + "[a-z]{2,6})" // first level domain- .com or .museum
		        + "(:[0-9]{1,4})?" // 端口- :80
		        + "((/?)|" // a slash isn't required if there is no file name
		        + "(/[0-9a-z_!~*'().;?:@&=+$,%#-]+)+/?)$";
		
		if (!email.match(myReg)){
			alert("地址不正确");
			document.getElementById('page_url').value="";
			document.getElementById('page_url').focus();
			return false;
 		}
 }

function searchForm(){
	 document.indexForm .submit();
}
 function oper(val)
 {
    var size = document.getElementById('listsize').value;
		var all_news_id='';
		for(var i=0;i<size;i++){
			if(document.getElementById('checkone'+i).checked===true){
				all_news_id += document.getElementById('checkone'+i).value+'|';
			}
		}
		 document.getElementById('pos_id').value = all_news_id;
		
		if(all_news_id==''){
			alert('请至少选择一条!');
			return false;
		}else{
   
    if(val=='0'){
    	
    		  	document.indexForm.action='/doTradeReg.do';
    		  	document.getElementById("state_code").value="0";
					  document.getElementById("bpm_id").value="5555";		
						
						document.indexForm.submit();
    }else if(val=='1'){  	
    	 			document.indexForm.action='/doTradeReg.do';
    	 			document.getElementById("state_code").value="1";
					  document.getElementById("bpm_id").value="5555";			
					  
						document.indexForm.submit();
    }
  }
 }

  function delOneNews(val){
	 
    if(window.confirm('确认删除吗?'))
    {
   	  window.location.href='/doTradeReg.do?pkid='+val+'&bpm_id=3084'; 
    } 
 
}
 
 